home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
cpp_libs
/
rjs.lha
/
RJS
/
String
/
src
/
replace.C
< prev
next >
Wrap
C/C++ Source or Header
|
1991-06-14
|
1KB
|
46 lines
#include "String.h"
#define DECLARE_REPLACE(arg1,arg2) \
\
RJS_String &RJS_String::replace(arg1 s1,arg2 s2) \
{ \
at(s1)=s2; \
return *this; \
}
#define DECLARE_REPLACE2(arg1) \
\
RJS_String &RJS_String::replace(const RJS_StringSearch &ss, \
arg1 s1,RJS_String &matched) \
{ \
int ss_len; \
int pos=ss.search(*this,ss_len); \
if (pos!=-1) { \
matched=substr(pos,ss_len); \
substr(pos,ss_len)=s1; \
} \
return *this; \
}
DECLARE_REPLACE(char,char)
DECLARE_REPLACE(char,const char *)
DECLARE_REPLACE(char,const RJS_String &)
DECLARE_REPLACE(const char *,char)
DECLARE_REPLACE(const char *,const char *)
DECLARE_REPLACE(const char *,const RJS_String &)
DECLARE_REPLACE(const RJS_String &,char)
DECLARE_REPLACE(const RJS_String &,const char *)
DECLARE_REPLACE(const RJS_String &,const RJS_String &)
DECLARE_REPLACE(const RJS_StringSearch &,char)
DECLARE_REPLACE(const RJS_StringSearch &,const char *)
DECLARE_REPLACE(const RJS_StringSearch &,const RJS_String &)
DECLARE_REPLACE2(char)
DECLARE_REPLACE2(const char *)
DECLARE_REPLACE2(const RJS_String &)